package test.my.com.myapplicationtest.paint_view;

/**
 * Created by ThinkPad on 2016/3/16.
 */
public class PaintAttributeModel {
    private int viewWidth;
    private int viewHeight;
    private float strokeWidthCoefficient;
    private String resPath;
    private String desPath;

    public PaintAttributeModel(Builder builder) {
        this.viewWidth = builder.viewWidth;
        this.viewHeight = builder.viewHeight;
        this.strokeWidthCoefficient = builder.strokeWidthCoefficient;
        this.resPath = builder.resPath;
        this.desPath = builder.desPath;
    }

    public int getViewWidth() {
        return viewWidth;
    }

    public void setViewWidth(int viewWidth) {
        this.viewWidth = viewWidth;
    }

    public int getViewHeight() {
        return viewHeight;
    }

    public void setViewHeight(int viewHeight) {
        this.viewHeight = viewHeight;
    }

    public float getStrokeWidthCoefficient() {
        return strokeWidthCoefficient;
    }

    public void setStrokeWidthCoefficient(float strokeWidthCoefficient) {
        this.strokeWidthCoefficient = strokeWidthCoefficient;
    }

    public String getResPath() {
        return resPath;
    }

    public void setResPath(String resPath) {
        this.resPath = resPath;
    }

    public String getDesPath() {
        return desPath;
    }

    public void setDesPath(String desPath) {
        this.desPath = desPath;
    }

    public static class Builder{
        private int viewWidth;
        private int viewHeight;
        private float strokeWidthCoefficient;
        private String resPath;
        private String desPath;

        /**
         * 设置 PaintView 的宽高（只是整体view宽高，和被绘制图片宽高无关）
         * @param viewWidth
         * @param viewHeight
         * @return
         */
        public Builder setViewWidthAndHeight(int viewWidth,int viewHeight){
            this.viewWidth = viewWidth;
            this.viewHeight = viewHeight;
            return this;
        }

        /**
         * 画笔粗细的系数
         * @param strokeWidthCoefficient
         * @return
         */
        public Builder strokeWidthCoefficient(float strokeWidthCoefficient){
            this.strokeWidthCoefficient = strokeWidthCoefficient;
            return this;
        }

        /**
         * 图片原地址（当只设置resPath时，认为在原图修改，保存后会覆盖原图）
         * @param resPath
         * @return
         */
        public Builder resPath(String resPath){
            this.resPath = resPath;
            return this;
        }

        /**
         * 绘制后图片的保存路径（despath为空时，默认覆盖原图）
         * @param desPath
         * @return
         */
        public Builder desPath(String desPath){
            this.desPath = desPath;
            return this;
        }
        public PaintAttributeModel build(){
            return new PaintAttributeModel(this);
        }

    }
}
